package main;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
/**
 * displays info about the unit
 * @author Bart Machielse and Justin yu
 *
 */
public class UnitInfo extends JFrame {
	Unit u;
	JPanel p = new JPanel();
	/**
	 * base constructor
	 * @param unit to construct for
	 */
	public UnitInfo(Unit unit) {
		super(unit.getName() +" info");
		u = unit;
		
		JLabel health = new JLabel("Health: " +u.cHealth +"/" +u.mHealth);
		JLabel radius = new JLabel("Movement radius: " +u.move);
		JLabel damage = new JLabel("Damage output: " +u.damage);
		
		p.add(health);
		p.add(radius);
		p.add(damage);
		
		this.add(p);
		this.setSize(200, 120);
		this.setVisible(true);
		
		addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent e) {
				u.infoOpen = false;
			}
		});
		
		}
}
